<template>
     <div id="addFill">
        <div class="jx-content part1">
             <el-form :inline="true" class="demo-form-inline clearfix" :model="form">
                <el-form-item label="年份 ：">
                  <el-input-number v-model="form.num8" controls-position="right"  @change="handleChange" :min="2010" :max="2019"></el-input-number>
                </el-form-item>
                <el-form-item label="班级 ：">
                    <el-select v-model="form.chooseClass" placeholder="请选择班级">
                        <el-option
                        v-for="item in form.optionsclass"
                        :key="item.value"
                        :label="item.label"
                        :value="item.value"
                        ></el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="状态 ：">
                    <el-select v-model="form.choosestatus" placeholder="请选择状态">
                        <el-option
                        v-for="item in form.optionstatus"
                        :key="item.value"
                        :label="item.label"
                        :value="item.value"
                        ></el-option>
                    </el-select>
                 </el-form-item>
                 <el-form-item >
                    <div class="button-style" @click="search">搜 索</div>
                </el-form-item>
             </el-form>
              <div class="tips"> 注：此列表按照默认班级检索</div>
              <div class="table">
                    <el-table :data="tableDataf"   style="width: 100%">
                    <el-table-column  prop="index" label="序号" > 
                         <template slot-scope="scope"><span>{{scope.$index+(currentPage - 1) * pagesize + 1}}</span> </template>
                    </el-table-column>
                    <el-table-column  prop="classname" label="班级姓名" > </el-table-column>
                    <el-table-column  prop="status" label="状态" ></el-table-column>
                    <el-table-column  prop="name" label="学生姓名"> </el-table-column>
                    <el-table-column
                        width="250"
                        prop="date"
                        :render-header="customFieldColumn"
                        label="随堂练习">
                        <template slot-scope="scope">
                             累计值：{{scope.row.date}}
                             <el-button @click="handleClick(scope.row.name,scope.row.id)" type="text" style="vertical-align: inherit">详情</el-button>
                             换算值：{{scope.row.date2}}
                         </template>
                    </el-table-column>
                    <el-table-column  prop="report" label="实验报告"  width="250"> 
                           <template slot-scope="scope">
                             累计值：{{scope.row.date}}
                             <el-button @click="detailFn(scope.row.name,scope.row.id)"  type="text" style="vertical-align: inherit">详情</el-button>
                             换算值：{{scope.row.date2}}
                         </template>
                    </el-table-column>
                    <el-table-column  prop="exampart" label="考试次数" > </el-table-column>
                    <el-table-column  prop="exam" label="考试成绩" :render-header="customField" :show-overflow-tooltip="true"> 
                         <template slot-scope="scope">
                            {{scope.row.exam }}
                        </template>
                    </el-table-column>
                   </el-table>
              </div>
              <el-pagination
                    @size-change="handleSizeChange"
                    @current-change="handleCurrentChange"
                    :current-page="currentPage"
                    :page-size="pagesize"
                    layout="total, prev, pager, next, jumper"
                    :total="totalCount"
               ></el-pagination>
         </div>
          <el-dialog :title="dialogTitle" :visible.sync="dialogFormVisible" width="650px"   @close="closeDialog">
             <el-table
                :data="Data"
                style="width: 100%; padding:0" >
                <el-table-column
                    prop="date"
                    label="日期"
                    width="180">
                </el-table-column>
                <el-table-column
                    prop="name"
                    label="姓名"
                    width="180">
                </el-table-column>
                <el-table-column
                    prop="address"
                    label="地址">
                </el-table-column>
             </el-table>
              <el-pagination
                    @size-change="handleSizeChange"
                    @current-change="handleCurrentChange"
                    :current-page="currentPage"
                    :page-size="pagesize"
                    layout="total, prev, pager, next, jumper"
                    :total="totalCount"
                    style="margin-top: 20px; text-align: center;">
                </el-pagination>
          </el-dialog>
    </div>
  
</template>

<script>
    export default {
        data () {
            return {
                Data:[{
                     date: '2016-05-02',
                    name: '王小虎',
                    address: '上海市普陀区金沙江路 1518 弄'
                  },
                ],
                dialogFormVisible:false,
                dialogTitle:'',
                tableDataf: [{
                    classname: '2016-05-02',
                    status: '未',
                    name:'123',
                    address: '上海市普陀区金沙江路 1518 弄',
                    date:'100',
                    date2:'20',
                    report1:'100',
                    report2:'20',
                    exampart:'100',
                    exam:'50,80,90,100，50,80,90,100，50,80,90,100，50,80,90,100，50,80,90,100'
                    }],
                 currentPage: 1,
                 pagesize: 10,
                 totalCount: 1000,
                 form:{
                   num8: 2010,
                   chooseClass:'',
                   optionsclass:[{
                        value: '选项1',
                        label: '黄金糕1'
                        }, {
                        value: '选项2',
                        label: '双皮奶1'
                        }
                   ],
                   choosestatus:'',
                   optionstatus:[
                       { value: '选项3',
                        label: '黄金糕'
                        }, {
                        value: '选项4',
                        label: '双皮奶'
                        }
                   ],
                },
                tableData:[]
            }
        },
        created() {
        },
       

        methods: {
            //关闭
            closeDialog(){
                this.$refs.form.resetFields()
            },
            //成绩弹窗
            detailFn(name,id){
              this.dialogFormVisible=true
              this.dialogTitle=name+'学生随堂练习成绩详情'

            },
            //提示
            customFieldColumn (h, { column, $index }) {
                return (
                    h('span', [
                    h('span', column.label + ' '),
                    h('el-tooltip', {
                        props: {
                        effect: 'dark',
                        class:'hh',
                        //content: '可在右上角（更多操作 - 自定义字段设置）中配置！',
                        placement: 'bottom'
                        }
                    }, [
                        h('i', {
                          class: 'iconfont icon-wenti-m',
                          style:'color:#1277eb'
                        }),
                        <div slot="content">平时成绩换算值：该同学当前章节平时分*（100/<br/>当前班级当前章节最高平时分）</div>
                        
                    ])
                    ])
                )
            },
             //提示
            customField (h, { column, $index }) {
                return (
                    h('span', [
                    h('span', column.label + ' '),
                    h('el-tooltip', {
                        props: {
                        effect: 'dark',
                        class:'hh',
                        content: '按照时间顺序排列成绩',
                        placement: 'bottom'
                        }
                    }, [
                        h('i', {
                          class: 'iconfont icon-wenti-m',
                          style:'color:#1277eb'
                        }),
                        
                    ])
                    ])
                )
            },
            //计数
             handleChange(value) {
                console.log(value);
            },
             //搜索
            search(){
              
            },
            //分页
			handleSizeChange: function (size) {
				this.pagesize = size;
			},
			handleCurrentChange: function(currentPage) {
                this.currentPage = currentPage
                //this.init()
            },
        },
        //  filter: {
        //     ellipsis (value) {
        //         console.log(value.length)
        //     if (!value) return ''
        //     if (value.length > 8) {
        //         return value.slice(0,8) + '...'
        //     }
        //     return value
        //     }
        // }
    }
</script>
<style scoped>
    .el-dialog__wrapper>>>.el-dialog__body{
        padding: 0!important;
    }
    .el-input-number.is-controls-right>>>.el-input-number__increase{
        line-height: 16px;
    }
    .el-input-number{
        position: relative;
        display: inline-block;
        line-height: 38px;
        overflow: hidden;
        width: auto;
    }
    .el-input-number>>>.el-input-number__increase{
        top: 4px;
    }
    .el-input-number.is-controls-right>>>.el-input-number__decrease{
         bottom: 4px;
    }
    .el-input-number>>>.el-input .el-input__inner{
        width: 100px;
    }
   
</style>
<style lang="scss" scoped>
 @import "./../../../styles/layout/color_variables";
  #addFill {
    width: $width;
    margin: 20px auto;
    color: #727272;
    .part1{
        .el-form-item{
             margin-bottom:0px;
         }
        .tips{
            margin-left: 10px;
            color: #1277eb;
        } 
    }
    .table{
        margin: 20px 0;
    }
}
</style>